{extend name="base"/}
{block name="resources"}
<style type="text/css">
</style>
{/block}
{block name="main"}
<div class="layui-form ns-form">
	<div class="layui-form-item">
		<label class="layui-form-label">订单类型：</label>
		<div class="layui-input-inline">
			{$info.order_type_name}
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">订单总额：</label>
		<div class="layui-input-inline">
			{$info.order_money}
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">订单状态：</label>
		<div class="layui-input-inline">
			{$info.order_status_name}
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">付款时间：</label>
		<div class="layui-input-inline">
			{$info.pay_time > 0 ?  time_to_date($info.pay_time) : '--'}
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">订单编号：</label>
		<div class="layui-input-inline">
			{$info.order_no}
		</div>
	</div>

	{if $info.type == 'group'}
		<div class="layui-form-item">
			<label class="layui-form-label">套餐名称：</label>
			<div class="layui-input-inline">
				{$info.group_name}
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label img-upload-lable">套餐图片：</label>
			<div class="layui-input-block img-upload">
				<input type="hidden" class="layui-input" name="group_image" />
				<div class="upload-img-block icon">
					<div class="upload-img-box">
						<img layer-src src="{:img($info.group_image)}" onerror=src="ADMIN_IMG/default_shop.png" >
					</div>
				</div>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">套餐时长：</label>
			<div class="layui-input-inline">
				{$info.group_num}{if $info.group_period_unit == 'week'} 周 {elseif $info.group_period_unit == 'month'} 月 {elseif $info.group_period_unit == 'year'} 年 {/if}
			</div>
		</div>

		<div class="layui-form-item distribution-index">
			<label class="layui-form-label">价格：</label>
			<div class="layui-input-block">
				<div class="layui-input-inline">
					{$info.group_period_price}元 /{if $info.group_period_unit == 'week'} 周 {elseif $info.group_period_unit == 'month'} 月 {elseif $info.group_period_unit == 'year'} 年 {/if}
				</div>
			</div>
		</div>
	{/if}

	<!-- 短信充值套餐 -->
	{if $info.order_type == 'sms'}
		<div class="layui-form-item">
			<label class="layui-form-label">短信套餐：</label>
			<div class="layui-input-inline">
				{$info.sms_package_name}
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">短信数量：</label>
			<div class="layui-input-inline">
				{$info.sms_package_num}
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">短信价格：</label>
			<div class="layui-input-inline">
				{$info.sms_package_price}
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">短信套餐数量：</label>
			<div class="layui-input-inline">
				{$info.sms_num}
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">短信套餐总价：</label>
			<div class="layui-input-inline">
				{$info.sms_money}
			</div>
		</div>

	{/if}

	<div class="layui-form-item">
		<label class="layui-form-label img-upload-lable"><span class="required">*</span>付款凭证：</label>
		<div class="layui-input-inline img-upload">
			<div class="upload-img-block icon">
				<div class="upload-img-box">
					{if condition="$info.paying_money_certificate"}
					<img layer-src src="{:img($info.paying_money_certificate)}" />
					{/if}
				</div>
			</div>
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label"><span class="required">*</span>付款凭证说明：</label>
		<div class="layui-input-inline">
			{$info.paying_money_certificate_explain}
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label"><span class="required">*</span>订单状态：</label>
		<div class="layui-input-inline">
			{$info.order_status_name}
		</div>
	</div>
	<!-- 表单操作 -->
	<div class="ns-form-row">
		{if $info.order_status == 2}
			<button class="layui-btn ns-bg-color" onclick="auditPass()">审核通过</button>
			<button class="layui-btn ns-bg-color" onclick="auditRefuse()">审核拒绝</button>
		{/if}
		<button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
	</div>
</div>

{/block}
{block name="script"}
<script>
	var pass_repeat_flag = false, refuse_repeat_flag = false;
	//审核通过
	function auditPass(){
		if(pass_repeat_flag) return false;
		pass_repeat_flag = true;

		layer.confirm('是否审核通过?', function() {
			$.ajax({
				title: '审核提醒',
				type: 'POST',
				dataType: 'JSON',
				url: ns.url("admin/sysorder/pass"),
				data: {order_id: '{$info.order_id}'},
				success: function(res) {
					pass_repeat_flag = false;
					layer.msg(res.message);
					if (res.code == 0) {
						location.reload();
					}
				}
			});
		}, function () {
			layer.close();
			pass_repeat_flag = false;
		});
	}

	//审核拒绝
	function auditRefuse(){

		if(refuse_repeat_flag) return false;
		refuse_repeat_flag = true;

        layer.confirm('是否审核拒绝?', function() {
            $.ajax({
                title: '审核提醒',
                type: 'POST',
                dataType: 'JSON',
                url: ns.url("admin/sysorder/refuse"),
                data: {order_id: '{$info.order_id}'},
                success: function(res) {
					refuse_repeat_flag = false;
					layer.msg(res.message);
					if (res.code == 0) {
						location.reload();
					}
                }
            });
        }, function () {
            layer.close();
			refuse_repeat_flag = false;
        });

	}
	function back() {
		location.href = ns.url("admin/sysorder/lists");
	}
</script>
{/block}